import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class ValidatePasswordHash {
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        
        String inputPassword = "admin123";
        String storedHash = "$2a$10$92tS6m3626VZ.zAgEJRw0.3Xg3P8yWYyWYyWYyWYyWYyWYyWYyWYy";
        
        boolean isValid = encoder.matches(inputPassword, storedHash);
        
        System.out.println("输入密码: " + inputPassword);
        System.out.println("存储哈希: " + storedHash);
        System.out.println("验证结果: " + isValid);
        
        // 生成一个新的哈希用于对比
        String newHash = encoder.encode("admin123");
        System.out.println("新生成哈希: " + newHash);
        System.out.println("新哈希验证: " + encoder.matches("admin123", newHash));
    }
}